import { lazy } from "react"
import { useRoutes } from "react-router-dom"

// 导入一级路由
import Home from "../pages/Home/Home"
import About from "../pages/About/About"

// 二级路由使用懒加载的方式
const A=lazy(()=>import("../pages/A/A"))
const B=lazy(()=>import("../pages/B/B"))

// 定义导出的函数
const GetRoutes=()=>{
    return useRoutes([
        {
            path:"/home",element:<Home/>,children:[
                // 默认展示的子路由
                {path:'',element:<A/>},
                {path:'b',element:<B/>}
            ]
        },
        {
            path:"/about",element:<About/>
        }
    ])
}

export default GetRoutes